<template>
	<view class="container">
		<view class="square" v-if="Info.ID>0">
			<view class="title">{{Info.Name}}</view>
			<view class="line" v-if="Info.Brief!=''"><view class="value2">{{Info.Brief}}</view></view>
			<view class="line"><view class="name">开放时间</view><view class="value">{{Info.OpenTime}}</view></view>
			<view class="line"><view class="name">法定假日</view><view class="value">{{Info.HolidayText}}</view></view>
			<template v-if="Role==1">
			<view class="line"><view class="name">联系人</view><view class="value">{{Info.ConnectName}}</view></view>
			<view class="line"><view class="name">联系电话</view><view class="value">{{Info.ConnectPhone}}</view><view class="mobile" @click="OpenCall(Info.ConnectPhone)"><image src="/static/shouji.png"/></view></view>
			</template>
			<view class="line"><view class="name">地理位置</view><view class="value">{{Info.Address}}</view><view class="mobile" @click="OpenAddress(Info)"><image src="/static/daohang.png"/></view></view>
			<view class="context">
				<image v-for="(item,index) in ImgList" :src="Tools.GetImg(item,1000)" mode="widthFix" @click="Tools.PrevImg(ImgList, index)"/>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onShareAppMessage: function() {
			var UserID = uni.getStorageSync("UserID");
		    return {
		      title: this.Info.Name,
		      path: "pages/room/roominfo?ParentID="+UserID+"&ID="+this.ID//这是一个路径
		    }
		},
		data() {
			return {
				ID:0,
				Role:0,
				Info:{ID:0},
				ImgList:[]
			};
		},
		onLoad(options) {
			this.ID=options.ID;
			this.Role = uni.getStorageSync("Role");
			this.Util.SetParam(options); 
			this.Find_RoomInfo();
		},
		methods:{
			OpenAddress(room){
				uni.openLocation({
					name:room.Name,
					address:room.Address,
					latitude: room.Lat,
					longitude: room.Lng,
					success: function () {
						
					}
				});
			},
			OpenCall(Mobile){
				uni.makePhoneCall({
					phoneNumber: Mobile //仅为示例
				});
			},
			Find_RoomInfo(){
				var data = {};
				data.Act="Find_RoomInfo";
				data.ID=this.ID;
				this.Util.Loading("加载中...");
				this.Util.Post(data, json=>{
					this.Util.HideLoading();
					uni.stopPullDownRefresh();
					uni.hideNavigationBarLoading();
					this.Info = json.Data.Info;
					this.ImgList= [json.Data.Info.Img].concat(json.Data.Info.Context.ToList());
				});
			}
		}
	}
</script>

<style lang="scss">
	.container{
		.square{width:700rpx; min-height: 800rpx; margin:0 auto; background-color: #ffffff; border-radius: 20rpx; margin-top:25rpx; margin-bottom: 35rpx; padding-top:20rpx; padding-bottom: 20rpx;
			.tip{width:100%; height: 380rpx; line-height: 380rpx; text-align: center; font-size:30rpx; color:#696969;}
			.bind{width:300rpx; height:90rpx; line-height: 90rpx; margin:0 auto; font-size:32rpx; border-radius: 20rpx; text-align: center; background-color: #4682e9; color:#ffffff;}
			.bind:active{opacity: 0.6;}
			.title{width:100%; height:80rpx; line-height: 80rpx; text-align: center; font-size:36rpx; font-weight: bold;} 
			.headimg{width:660rpx; margin:0 auto; margin-top:10rpx; margin-bottom: 30rpx; image{width:660rpx; height:360rpx;}}
			.line{width:660rpx; min-height:60rpx; line-height: 45rpx; margin:0 auto; display: flex; flex-direction: row; flex-wrap: wrap; font-size:32rpx;
				.name{width:140rpx; line-height: 40rpx; color:#000000;}
				.value{flex:1; line-height: 40rpx; color:#8a8a8a; padding-right: 10rpx;}
				.name2{width:100%; line-height: 40rpx; color:#000000;}
				.value2{width:100%; line-height: 40rpx; color:#8a8a8a; padding-top:15rpx; padding-bottom: 15rpx;}
				.mobile{width:50rpx; height: 50rpx; margin-top:4rpx; border-radius: 10rpx; padding-left:6rpx; padding-top:8rpx; background-color: #dedede; image{width:34rpx; height: 34rpx; opacity:0.8;}}
				.mobile:active{background-color: #696969;}
			}
			.context{width:660rpx; margin:0 auto; margin-top:20rpx; image{width:100%;}}
		}
	}
</style>
